package com.aferzsoft.colorslide;

import com.aferzsoft.colorslide.classes.GameSurface;
import com.aferzsoft.colorslide.classes.OnSwipeTouchListener;
import com.aferzsoft.colorslide.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity{
	
	private GameSurface gameSurface;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    requestWindowFeature(Window.FEATURE_NO_TITLE);
	    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.activity_main);

		this.gameSurface = (GameSurface) findViewById(R.id.gameSurface);
		this.gameSurface.setOnTouchListener( new OnSwipeTouchListener( this.getApplicationContext() ){

			@Override
			public void onSwipeRight() {
				gameSurface.getGrid().swipeRight();
			}

			@Override
			public void onSwipeLeft() {
				gameSurface.getGrid().swipeLeft();
			}

			@Override
			public void onSwipeTop() {
				gameSurface.getGrid().swipeUp();
			}

			@Override
			public void onSwipeBottom() {
				gameSurface.getGrid().swipeDown();
			}
			
			public boolean onTouch(View v, MotionEvent event) {
			    return gestureDetector.onTouchEvent(event);
			}
			
		});

	}
	
	@Override
	protected void onPostCreate(Bundle savedInstanceState) {
		super.onPostCreate(savedInstanceState);
	}
	
	
	@Override
	protected void onPause(){
		super.onPause();
	}
	
	@Override
	protected void onResume(){
		super.onResume();
	}

}

